In [10]:
import tensorflow as tf 
import numpy as np
from tensorflow.contrib.tensorboard.plugins import projector
import os

1. Load the embeddings


In [11]:
LOG_DIR = 'tmp/tb/2'
data = np.load('compressed_output.npy')
tf.reset_default_graph()
images = tf.Variable(data, name='embeddings')

In [12]:
sess = tf.InteractiveSession()

saver = tf.train.Saver([images])
sess.run(images.initializer)
saver.save(sess,os.path.join(LOG_DIR,'images.ckpt'))

config = projector.ProjectorConfig()
embedding = config.embeddings.add()
embedding.tensor_name = images.name
embedding.metadata_path = 'compressed_metadata.tsv'
projector.visualize_embeddings(tf.summary.FileWriter(LOG_DIR), config)

In [ ]: